Jump to content

- PBXCall

- # PBXCall.Hold

  Followers 0

  VBScript → Lua

  This function sets the current call on hold, meaning it starts playing the given music on hold file (wav) and returns.

      PBXCall.Hold "musiconhold.wav"

  This function returns an integer value of PBXSuccess (0) on success. See list of defined return values.

  In opposite to the GSE block Play Message which plays a wav file completely before returning, the hold function/block returns immediately.

  The one parameter of this function is the name of the wav file to be played. If no explicit path is given in the filename, SwyxServer searches this file in the database, in the following scopes in that order:

  1. User
  2. User Default
  3. Global
  4. System Default

  It is also possible to play a local file from the SwyxServer machine. In this case it is necessary, that the Windows user account the SwyxServer service is running under (usually the SwyxServiceAccount), has read privileges on that file.

      PBXCall.Hold "C:\Announcements\MyMusicOnHold.wav"

  There is one magic string as parameter available:

      PBXCall.Hold "*hold*"

  Using this magic string uses the configured system music on hold.

  Putting a call on hold can be used to start a waiting music and then waiting within a loop for an avaible agent. Don't miss to use the PBXScript.Sleep function when looping while waiting for something to prevent 100% cpu load. While being in such a loop it is also recommended to check regularly with PBXCall.IsOriginatorDisconnected if the caller has disconnected the call in the meantime.

  A call currently being set on hold can be activated by using the PBXCall.Activate function, i.e. stop playing music on hold. Alternatively all Play Sound blocks and all "Connect" blocks (Connect To, Follow Me and Loop) will automatically activate a call being on hold.

  Once a call is on hold you can use the PBXCall.PlayMessage function to play some additional announcements. In this special case, by using the api function directly instead of a gse block, the music on hold will be faded down, the announcement will be played and afterwards the music on hold fades up. Please note the difference of using this api function instead of the standard gse blocks which would activate the call and stop the music on hold.

  You can check at any time if the current call is on hold by using the function PBXCall.IsOnHold.

  By Tom Wellige

  - May 16, 2022
  Share
  Share
  Followers 0

## Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.